/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.tratamiento.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "tipo_vacuna")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoVacuna.findAll", query = "SELECT t FROM TipoVacuna t"),
    @NamedQuery(name = "TipoVacuna.findByCodTipVacu", query = "SELECT t FROM TipoVacuna t WHERE t.codTipVacu = :codTipVacu"),
    @NamedQuery(name = "TipoVacuna.findByDescTipVacu", query = "SELECT t FROM TipoVacuna t WHERE t.descTipVacu = :descTipVacu")})
public class TipoVacuna implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Tip_Vacu", columnDefinition="CHAR(5) unsigned")
    private String codTipVacu;
    @Column(name = "Desc_Tip_Vacu")
    private String descTipVacu;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codTipovacu")
    private Collection<Vacuna> vacunaCollection;

    public TipoVacuna() {
    }

    public TipoVacuna(String codTipVacu) {
        this.codTipVacu = codTipVacu;
    }

    public String getCodTipVacu() {
        return codTipVacu;
    }

    public void setCodTipVacu(String codTipVacu) {
        this.codTipVacu = codTipVacu;
    }

    public String getDescTipVacu() {
        return descTipVacu;
    }

    public void setDescTipVacu(String descTipVacu) {
        this.descTipVacu = descTipVacu;
    }

    @XmlTransient
    public Collection<Vacuna> getVacunaCollection() {
        return vacunaCollection;
    }

    public void setVacunaCollection(Collection<Vacuna> vacunaCollection) {
        this.vacunaCollection = vacunaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTipVacu != null ? codTipVacu.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoVacuna)) {
            return false;
        }
        TipoVacuna other = (TipoVacuna) object;
        if ((this.codTipVacu == null && other.codTipVacu != null) || (this.codTipVacu != null && !this.codTipVacu.equals(other.codTipVacu))) {
            return false;
        }
        return true;
    }
    
}
